import 'osc_author.dart';

class OscCommentEntity {
	int replyCount;
	int star;
	List<OscProjectCommentRefer> refer;
	OscAuthor author;
	int voteState;
	bool best;
	int id;
	int viewCount;
	String pubDate;
	int vote;
	String content;
	int appClient;

	OscCommentEntity({this.replyCount, this.star, this.refer, this.author, this.voteState, this.best, this.id, this.viewCount, this.pubDate, this.vote, this.content, this.appClient});

	OscCommentEntity.fromJson(Map<String, dynamic> json) {
		replyCount = json['replyCount'];
		star = json['star'];
		if (json['refer'] != null) {
			refer = new List<OscProjectCommentRefer>();(json['refer'] as List).forEach((v) { refer.add(new OscProjectCommentRefer.fromJson(v)); });
		}
		author = json['author'] != null ? new OscAuthor.fromJson(json['author']) : null;
		voteState = json['voteState'];
		best = json['best'];
		id = json['id'];
		viewCount = json['viewCount'];
		pubDate = json['pubDate'];
		vote = json['vote'];
		content = json['content'];
		appClient = json['appClient'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['replyCount'] = this.replyCount;
		data['star'] = this.star;
		if (this.refer != null) {
      data['refer'] =  this.refer.map((v) => v.toJson()).toList();
    }
		if (this.author != null) {
      data['author'] = this.author.toJson();
    }
		data['voteState'] = this.voteState;
		data['best'] = this.best;
		data['id'] = this.id;
		data['viewCount'] = this.viewCount;
		data['pubDate'] = this.pubDate;
		data['vote'] = this.vote;
		data['content'] = this.content;
		data['appClient'] = this.appClient;
		return data;
	}
}

class OscProjectCommentRefer {
	String author;
	int voteState;
	OscAuthor commentAuthor;
	int commentId;
	int vote;
	String pubDate;
	String content;

	OscProjectCommentRefer({this.author, this.voteState, this.commentAuthor, this.commentId, this.vote, this.pubDate, this.content});

	OscProjectCommentRefer.fromJson(Map<String, dynamic> json) {
		author = json['author'];
		voteState = json['voteState'];
		commentAuthor = json['commentAuthor'] != null ? new OscAuthor.fromJson(json['commentAuthor']) : null;
		commentId = json['commentId'];
		vote = json['vote'];
		pubDate = json['pubDate'];
		content = json['content'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['author'] = this.author;
		data['voteState'] = this.voteState;
		if (this.commentAuthor != null) {
      data['commentAuthor'] = this.commentAuthor.toJson();
    }
		data['commentId'] = this.commentId;
		data['vote'] = this.vote;
		data['pubDate'] = this.pubDate;
		data['content'] = this.content;
		return data;
	}
}
